// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import { game } from "../../../../../script/game/control/game";
import { companyBase } from "../../../../../script/game/control/Item/ItemBase";
import { companyType, playerType } from "../../../../../script/game/gameType";
import { ListItem } from "../../../../../script/util/ListView/ListItem";
import { ccs } from "../../../../../script/util/services";
import { touchExd } from "../../../../../script/util/TouchExtend";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends ListItem<playerType> {
    

    @property(cc.Label)
    title: cc.Label = null;

    @property(cc.Label)
    age: cc.Label = null;

    @property(cc.Label)
    money: cc.Label = null;

    @property(cc.Label)
    level: cc.Label = null;

    @property(cc.Label)
    levelName: cc.Label = null;

    @property(cc.RichText)
    edu: cc.RichText = null;

    start () {

    }

    initItem(data: playerType, index: number) {
        this.title.string = data.name;
        this.age.string = "年龄：" + data.age.toString();
        this.money.string = "工资：" + ccs.gf.getOmitNum(data.work.income);
        this.level.string = `专业等级：${data.work.level}级`;
        this.levelName.string = `职称：${data.work.levelName[data.work.level]}`;
        this.edu.string = `学历：${data.edu.name}`;
    }
    onItemclick(data: playerType) {
        //跳转详情页面
        ccs.winMgr.showWin("popAlert", {content: `聘用${data.name}为公司的ceo吗？`, cb: () => {
            ccs.mainEmitter.emit("hireCeo", data);
        }});
    }
    // update (dt) {}
}
